<?php
	
class Message
{
	private $Id;
	private $IdSender;
	private $IdReceiver;
	private $Subject;
	private $Text;
	private $Date;
	private $IsRead;
	
	public function getId()
	{
		if(!isset($this->Id))
			$this->setId(0);
		return $this->Id;
	}
	public function setId($id)
	{
		$this->Id = $id;
	}
	public function IsPersited()
	{
		return $this->getId() != 0;
	}
	
	public function getIdSender()
	{
		if(!isset($this->IdSender))
			$this->setIdSender(0);
		return $this->IdSender;
	}
	public function setIdSender($id)
	{
		$this->IdSender = $id;
	}
	
	public function getIdReceiver()
	{
		if(!isset($this->IdReceiver))
			$this->setIdReceiver(0);
		return $this->IdReceiver;
	}
	public function setIdReceiver($id)
	{
		$this->IdReceiver = $id;
	}
	
	public function getSubject()
	{
		if(!isset($this->Subject))
			$this->setSubject('');
		return $this->Subject;
	}
	public function setSubject($name)
	{
		$this->Subject = $name;
	}
	
	public function getText()
	{
		if(!isset($this->Text))
			$this->setText('');
		return $this->Text;
	}
	public function setText($name)
	{
		$this->Text = $name;
	}
	
	public function getIsRead()
	{
		if(!isset($this->IsRead))
			$this->setIsRead(false);
		return $this->IsRead;
	}
	public function setIsRead($isRead)
	{
		$this->IsRead = (bool)$isRead;
	}
	
	public function getDate()
	{
		if(!isset($this->Date))
			$this->setDate(date("Y-m-d H:i:s"));
		return $this->Date;
	}
	public function setDate($name)
	{
		$this->Date = $name;
	}
}
?>